package com.hl.card.common.persistence.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.baomidou.mybatisplus.annotations.TableName;
import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hl.card.common.persistence.model.ckeck.CurrencyCheck;
import com.hl.card.common.persistence.model.ckeck.CurrencyUpdateCheck;
import com.hl.card.common.persistence.model.ckeck.ExchangeCheck;
import com.hl.card.common.persistence.model.ckeck.RechargeCheck;
import com.hl.card.common.persistence.model.ckeck.RechargeDocCheck;
import com.hl.card.common.persistence.model.ckeck.RechargeUserCheck;

/**
 * <p>
 * 充值记录
 * </p>
 *
 * @author huangpu
 * @since 2018-08-15
 */
@TableName("recharge") // 注解指定表名
public class Recharge extends Model<Recharge> {
    private static final long serialVersionUID = 1L;
    public Recharge() {
		super();
	}
	public Recharge(@NotBlank(message = "编号不能为空", groups = { RechargeCheck.class, CurrencyCheck.class,
			ExchangeCheck.class, RechargeDocCheck.class, CurrencyUpdateCheck.class }) String recharge_no) {
		super();
		this.recharge_no = recharge_no;
	}

	/**
     * 编号
     */
    @NotBlank(message = "编号不能为空" ,groups={RechargeCheck.class,CurrencyCheck.class,ExchangeCheck.class,RechargeDocCheck.class,CurrencyUpdateCheck.class})
	private String recharge_no;
    /**
     * 跟单账号
     */
	private String doc_account;
    /**
     * 跟单时间
     */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date doc_time;
    /**
     * 申请时间
     */
	@NotNull(message = "申请时间不能为空",groups={RechargeCheck.class,CurrencyCheck.class,ExchangeCheck.class})
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date add_time;
	
	/**
	 * 申请时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private transient Date add_time_end;
    /**
     * 审核时间
     */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date audit_time;
    /**
     * 状态
     */
	private Integer status;
    /**
     * 通证名称
     */
	@NotBlank(message = "通证名称不能为空",groups={RechargeCheck.class,CurrencyCheck.class,ExchangeCheck.class})
	private String currency;
    /**
     * 充值|兑换数量
     */
	@NotNull(message = "充值|提币|兑换数量不能为空",groups={RechargeCheck.class,CurrencyCheck.class,ExchangeCheck.class})
	private Double amount;
    /**
     * 实际收款
     */
	private Double actual_amount;
    /**
     * 转账地址
     */
	@NotBlank(message = "转账地址不能为空")
	private String remarkInfo;
    /**
     * 绑定手机
     */
	@NotBlank(message = "绑定手机不能为空")
	private String binding_phone;
    /**
     * 确认转账时间
     */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date confirm_transfer_time;
    /**
     * 备注
     */
	private String remarks;
    /**
     * 转账交易记录号
     */
	@NotBlank(message = "转账交易记录号不能为空",groups={CurrencyUpdateCheck.class})	
	private String trans_order_id;
    /**
     * 矿工费
     */
	@NotNull(message = "矿工费不能为空",groups={CurrencyCheck.class,CurrencyUpdateCheck.class})
	private Double miner;
    /**
     * 手续费
     */
	@NotNull(message = "手续费不能为空",groups={CurrencyCheck.class})
	private Double poundage;
	/**
	 * 姓名
	 */
	@NotBlank(message = "姓名不能为空",groups={CurrencyCheck.class,ExchangeCheck.class})
	private String full_name;
    /**
     * 取消时间
     */
	private Date cancel_time;
    /**
     * 取消原因
     */
	private String cancel_reason;
	
	@NotBlank(message = "用户id不能为空",groups={RechargeUserCheck.class})
	private String user_id;
    /**
     * 类型 RECHARGE 充值， WITHDRAW 提币，  EXCHANGE 兑换
     */
	@NotBlank(message = "充值|提币|兑换类型不能为空",groups={RechargeCheck.class,CurrencyCheck.class,ExchangeCheck.class})
	private String extra;
    /**
     * 兑换时汇率
     */
	@NotNull(message = "兑换时汇率不能为空",groups={ExchangeCheck.class})
	private Double rate;
    /**
     * 消耗比豆
     */
	@NotNull(message = "消耗比豆数量不能为空",groups={ExchangeCheck.class})
	private Double consume;
	
	private transient List<String> recharge_nos;
	

	public String getRecharge_no() {
		return recharge_no;
	}

	public void setRecharge_no(String recharge_no) {
		this.recharge_no = recharge_no;
	}

	public String getDoc_account() {
		return doc_account;
	}

	public void setDoc_account(String doc_account) {
		this.doc_account = doc_account;
	}

	public Date getDoc_time() {
		return doc_time;
	}

	public void setDoc_time(Date doc_time) {
		this.doc_time = doc_time;
	}

	public Date getAdd_time() {
		return add_time;
	}

	public void setAdd_time(Date add_time) {
		this.add_time = add_time;
	}

	public Date getAdd_time_end() {
		return add_time_end;
	}

	public void setAdd_time_end(Date add_time_end) {
		this.add_time_end = add_time_end;
	}

	public String getFull_name() {
		return full_name;
	}

	public void setFull_name(String full_name) {
		this.full_name = full_name;
	}

	public Date getAudit_time() {
		return audit_time;
	}

	public void setAudit_time(Date audit_time) {
		this.audit_time = audit_time;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public Double getActual_amount() {
		return actual_amount;
	}

	public void setActual_amount(Double actual_amount) {
		this.actual_amount = actual_amount;
	}

	public String getRemarkInfo() {
		return remarkInfo;
	}

	public void setRemarkInfo(String remarkInfo) {
		this.remarkInfo = remarkInfo;
	}

	public String getBinding_phone() {
		return binding_phone;
	}

	public void setBinding_phone(String binding_phone) {
		if (binding_phone!=null && !binding_phone.equals("")) {
			this.binding_phone = binding_phone;
		}
	}

	public Date getConfirm_transfer_time() {
		return confirm_transfer_time;
	}

	public void setConfirm_transfer_time(Date confirm_transfer_time) {
		this.confirm_transfer_time = confirm_transfer_time;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getTrans_order_id() {
		return trans_order_id;
	}

	public void setTrans_order_id(String trans_order_id) {
		this.trans_order_id = trans_order_id;
	}

	public Double getMiner() {
		return miner;
	}

	public void setMiner(Double miner) {
		this.miner = miner;
	}

	public Double getPoundage() {
		return poundage;
	}

	public void setPoundage(Double poundage) {
		this.poundage = poundage;
	}

	public Date getCancel_time() {
		return cancel_time;
	}

	public void setCancel_time(Date cancel_time) {
		this.cancel_time = cancel_time;
	}

	public String getCancel_reason() {
		return cancel_reason;
	}

	public void setCancel_reason(String cancel_reason) {
		this.cancel_reason = cancel_reason;
	}

	public String getExtra() {
		return extra;
	}

	public void setExtra(String extra) {
		this.extra = extra;
	}

	public Double getRate() {
		return rate;
	}

	public void setRate(Double rate) {
		this.rate = rate;
	}

	public Double getConsume() {
		return consume;
	}

	public void setConsume(Double consume) {
		this.consume = consume;
	}

	@Override
	protected Serializable pkVal() {
		return this.recharge_no;
	}

	public List<String> getRecharge_nos() {
		return recharge_nos;
	}

	public void setRecharge_nos(List<String> recharge_nos) {
		this.recharge_nos = recharge_nos;
	}

	public String getUser_id() {
		return user_id;
	}

	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Recharge={\"recharge_no\":\"" + recharge_no + "\", \"doc_account\":\"" + doc_account
				+ "\", \"doc_time\":\"" + doc_time + "\", \"add_time\":\"" + add_time + "\", \"audit_time\":\""
				+ audit_time + "\", \"status\":\"" + status + "\", \"currency\":\"" + currency + "\", \"amount\":\""
				+ amount + "\", \"actual_amount\":\"" + actual_amount + "\", \"remarkInfo\":\"" + remarkInfo
				+ "\", \"binding_phone\":\"" + binding_phone + "\", \"confirm_transfer_time\":\""
				+ confirm_transfer_time + "\", \"remarks\":\"" + remarks + "\", \"trans_order_id\":\"" + trans_order_id
				+ "\", \"miner\":\"" + miner + "\", \"poundage\":\"" + poundage + "\", \"full_name\":\"" + full_name
				+ "\", \"cancel_time\":\"" + cancel_time + "\", \"cancel_reason\":\"" + cancel_reason
				+ "\", \"user_id\":\"" + user_id + "\", \"extra\":\"" + extra + "\", \"rate\":\"" + rate
				+ "\", \"consume\":\"" + consume + "\"}";
	}

}
